﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using MySql.Data.MySqlClient;

public partial class Admin_AddCar: System.Web.UI.Page {
    DBAcess db = new DBAcess();
    protected void Page_Load(object sender, EventArgs e)
    {
        Page.Title = "Add Car | Nexus-Z Auto Rental";
        Button2.CausesValidation = false;
        if (Session["role"] == null)
        {
            Response.Redirect("~/Default.aspx");
        }
    }
    protected void Button1_Click(object sender, EventArgs e) {
        db.open();
        MySqlCommand cmd = new MySqlCommand( "INSERT INTO car(plate_no, brand, make, color, speed, tariff,availability) values('" + TextBox5.Text + "', '" + TextBox1.Text + "', '" + TextBox2.Text + "', '" + TextBox3.Text + "', '" + TextBox4.Text + "', " + TextBox6.Text + ",1)", db.returnCon() );
        cmd.ExecuteNonQuery();
        db.close();
        Response.Redirect("~/Admin/Car/EditCar.aspx");

    }
}